// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Lu Rong
// Date   : 2005-03-18

#ifndef __TRENCHLIST_H_CLIENT_MAIN__
#define __TRENCHLIST_H_CLIENT_MAIN__

#pragma once 

#include <common/ui/listview.h>

namespace JoyTrenchElem
{

class CJoyTrenchList;

//##ModelId=44C4B5DA0292
class CJoyTrenchListField : public CJoyListViewField
{	
protected:
	//##ModelId=44C4B5DA02A0
	virtual void CM_LoadSkin(CJoyXmlElement *pSkinElem)
	{
		__super::CM_LoadSkin(pSkinElem);

		m_itemTextColor.SetValue(pSkinElem->ReadIntX("item_text_color", m_itemTextColor.GetValue()));
	}
	//##ModelId=44C4B5DA02A3
	virtual void CM_Draw(Graphics &graph);
public:
	//##ModelId=44C4B5DA02B0
	Color m_itemTextColor;

	//##ModelId=44C4B5DA02B4
	CJoyTrenchListField() 
	{
		m_itemTextColor.SetValue(0x00000000);
	}
	//##ModelId=44C4B5DA02B5
	virtual ~CJoyTrenchListField() {}
};

//##ModelId=44C4B5DA02BF
class CJoyTrenchListItem : public CJoyListViewItem
{
protected:
	//##ModelId=44C4B5DA02C1
    virtual void CM_Draw(Graphics& graph);
public:
	//##ModelId=44C4B5DA02D0
	CStringW	m_nickName;
	//##ModelId=44C4B5DA02D4
	int			m_killCount;
	//##ModelId=44C4B5DA02D5
	int			m_bekillCount;
public:
	//##ModelId=44C4B5DA02DE
	CJoyTrenchListItem() : m_killCount(0), m_bekillCount(0) {}
	//##ModelId=44C4B5DA02DF
	virtual ~CJoyTrenchListItem() {}

	//##ModelId=44C4B5DA02E1
	CJoyTrenchList * GetTrenchList() const
	{
		return (CJoyTrenchList *)m_listView;
	}
};

//##ModelId=44C4B5DA02EE
class CJoyTrenchListItemPanel : public CJoyListViewPanel
{
protected:
	//##ModelId=44C4B5DA02F1
	Color	m_backColor2;

	//##ModelId=44C4B5DA02F5
	virtual void CM_Draw(Graphics& graph);
	//##ModelId=44C4B5DA02FE
	virtual void CM_LoadSkin(CJoyXmlElement *pSkinElem);
public:
	//##ModelId=44C4B5DA0301
	CJoyTrenchListItemPanel();
	//##ModelId=44C4B5DA0302
	virtual ~CJoyTrenchListItemPanel() {}

	//##ModelId=44C4B5DA0304
	CJoyTrenchList * GetTrenchList() const
	{
		return (CJoyTrenchList *)m_listView;
	}
};

//##ModelId=44C4B5DA030E
class CJoyTrenchList : public CJoyListView
{
	DECLARE_DYNAMIC(CJoyTrenchList)

protected:
	friend class CJoyTrenchListItemPanel;

	//##ModelId=44C4B5DA031D
	virtual void CM_LoadSkin(CJoyXmlElement *pSkinElem);

	//##ModelId=44C4B5DA0320
	virtual CJoyListViewPanel* CreatePanel();

public:
	//##ModelId=44C4B5DA032D
	CJoyTrenchListField		*m_nicknameField;
	//##ModelId=44C4B5DA0332
	CJoyTrenchListField		*m_killcountField;
	//##ModelId=44C4B5DA0337
	CJoyTrenchListField		*m_bekillcountField;

	template<typename FieldType>
    void AddField_T(FieldType*& f, PCSTR name);

public:
	//##ModelId=44C4B5DA033E
	CJoyTrenchList();
	//##ModelId=44C4B5DA033F
	virtual ~CJoyTrenchList();

public:
	DECLARE_MESSAGE_MAP()
	//##ModelId=44C4B5DA0341
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

}; // namespace JoyTrenchElem

#endif // __TRENCHLIST_H_CLIENT_MAIN__
